Skip to content

Fix percentile to include players who lost the puzzle#28

Merged
kishanasokan merged 6 commits intomainfrom
fix/percentile-include-losses
Feb 25, 2026
Merged

Fix percentile to include players who lost the puzzle#28
kishanasokan merged 6 commits intomainfrom
fix/percentile-include-losses

Conversation

@kishanasokan
Copy link
Copy Markdown
Owner

Summary

  • The "How You Compare" percentile in the post-game results modal was only comparing against winners, ignoring players who failed the puzzle entirely
  • This caused misleadingly low rankings (e.g. "Top 43%" for a 1-guess win on a puzzle with only 60% win rate)
  • Now fetches times_played from game_stats_by_puzzle view and counts losers as "worse than user" in the percentile math

What changed

  • getPuzzleGuessDistribution() now also queries game_stats_by_puzzle for total attempts (including losses)
  • calculatePuzzlePercentile() accepts optional totalAttempts param and includes losers in the calculation
  • Added 5 unit tests for the updated percentile logic

What is NOT affected

  • StatsModal (general stats) — uses a different function (calculatePercentileBeat)
  • Local storage, IndexedDB, user progress, streaks, guess distributions
  • submitGameResult() and all game submission logic
  • No data writes — this is purely read-only display logic

Test plan

  • All 159 unit/integration/component tests pass
  • Play a puzzle, verify "How You Compare" percentile reflects correct ranking including failed players
  • Check archive puzzle results modal shows updated percentile
  • Confirm local stats (played, win %, streak, guess distribution) are unchanged

🤖 Generated with Claude Code

kishanasokan and others added 4 commits February 24, 2026 22:21
- Fix empty blue bar on large screens by using --full-vh viewport compensation
- Make Radiordle logo/title clickable to navigate home from archive
- Remove max-height cap on post-puzzle modal for desktop screens
- Add archive stats disclaimer under Statistics heading in results modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…de-to-close

- Replace opaque black backdrop with semi-transparent bg-black/50 on all modals
- Lock background scroll when any modal is open (body overflow: hidden)
- Add click-outside-to-close to Legal modals (Privacy Policy, Terms of Service)
- Remove desktop max-height cap on Stats modal to match Results modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The backdrop class change from bg-black to bg-black/50 broke E2E tests
that located modals via .fixed.inset-0.bg-black CSS selector. Replaced
with stable data-testid="results-modal" attribute.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The "How You Compare" percentile was only counting winners who took more
guesses, ignoring players who failed the puzzle entirely. This caused
misleadingly low rankings (e.g. "Top 43%" for a 1-guess win on a puzzle
with 60% win rate). Now fetches total attempts from game_stats_by_puzzle
and counts losers as "worse than user" in the percentile calculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
radwordle Ready Ready Preview, Comment Feb 25, 2026 11:52pm

kishanasokan and others added 2 commits February 25, 2026 17:50
The annotated image overlay added a second img[alt*="Puzzle"] element,
causing Playwright strict mode violations across all E2E shards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kishanasokan kishanasokan merged commit 083feea into main Feb 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants